import type { AppRouteModule } from '/@/router/types';

import { getParentLayout, LAYOUT } from '/@/router/constant';
import { t } from '/@/hooks/web/useI18n';

const system: AppRouteModule = {
  path: '/system',
  name: 'System',
  component: LAYOUT,
  redirect: '/system/branch',
  meta: {
    orderNo: 2000,
    priv: ['SystemManagerPriv'],
    icon: 'ion:settings-outline',
    title: t('routes.demo.system.moduleName'),
  },
  children: [
    {
      path: 'branch',
      name: 'BranchManager',
      meta: {
        priv: ['BranchManagerPriv'],
        title: t('routes.demo.system.dept'),
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/branch/index.vue'),
    },
    {
      path: 'role',
      name: 'RoleManager',
      meta: {
        priv: ['RoleManagerPriv'],
        title: '角色管理',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/role/index.vue'),
    },
    {
      path: 'user',
      name: 'UserManager',
      meta: {
        priv: ['UserManagerPriv'],
        title: '用户管理',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/user/index.vue'),
    },
    {
      path: 'security',
      name: 'Security',
      meta: {
        priv: ['AccountConfigPriv'],
        title: '账户安全',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/security/index.vue'),
    },
    {
      path: 'code',
      name: 'CodeManager',
      meta: {
        priv: ['CodeManagerPriv'],
        title: '代码管理',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/code/index.vue'),
    },
    {
      path: 'code_list/:codeType',
      name: 'CodeList',
      meta: {
        hideMenu: true,
        title: '代码列表',
        ignoreKeepAlive: true,
        showMenu: false,
        currentActiveMenu: '/system/code',
      },
      component: () => import('/@/views/system/code/codeItemList.vue'),
    },
    {
      path: 'config',
      name: 'ConfigManager',
      meta: {
        priv: ['ConfigManagerPriv'],
        title: '配置管理',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/config/index.vue'),
    },
    {
      path: 'schedule',
      name: 'ScheduleManager',
      meta: {
        priv: ['ScheduleManagerPriv'],
        title: '定时任务',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/schedule/index.vue'),
    },
    {
      path: 'plugin',
      name: 'PluginManager',
      meta: {
        priv: ['PluginManagerPriv'],
        title: '插件管理',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/plugin/index.vue'),
    },
    {
      path: 'log',
      name: 'SystemLog',
      meta: {
        priv: ['SystemLogPriv'],
        title: '系统日志',
        ignoreKeepAlive: true,
      },
      component: getParentLayout('SystemLog'),
      redirect: '/system/log/loginLog',
      children: [
        {
          path: 'loginLog',
          name: 'UserLoginLog',
          component: () => import('/@/views/system/log/loginlog/index.vue'),
          meta: {
            priv: ['UserLoginLogPriv'],
            title: '登录日志',
            ignoreKeepAlive: true,
          },
        },
        {
          path: 'operateLog',
          name: 'UserOperateLog',
          component: () => import('/@/views/system/log/operatelog/index.vue'),
          meta: {
            priv: ['UserOperateLogPriv'],
            title: '操作日志',
            ignoreKeepAlive: true,
          },
        },
        {
          path: 'sqllog',
          name: 'SqlLog',
          component: () => import('/@/views/system/log/sqllog/index.vue'),
          meta: {
            priv: ['SqlLogPriv'],
            title: 'SQL日志',
            ignoreKeepAlive: true,
          },
        },
        {
          path: 'logfies',
          name: 'DownloadLog',
          component: () => import('/@/views/system/log/logfies/index.vue'),
          meta: {
            priv: ['DownloadLogPriv'],
            title: '日志下载',
            ignoreKeepAlive: true,
          },
        },
      ],
    },
    {
      path: 'message',
      name: 'MessageManager',
      meta: {
        priv: ['RoleManagerPriv'],
        title: '消息管理',
        ignoreKeepAlive: true,
      },
      component: () => import('/@/views/system/message/index.vue'),
    },
  ],
};

export default system;
